package cn.sdstudio.dto;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 用户注册数据传输对象
 * @author zyq
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Schema(description = "用户注册请求数据模型")
public class RegistrationDTO {

    @NotBlank(message = "用户名不能为空")
    @Size(min = 3, max = 50, message = "用户名长度必须在 3 到 50 个字符之间")
    @Pattern(regexp = "^[a-zA-Z0-9_]+$", message = "用户名只能包含字母、数字和下划线")
    @Schema(description = "登录用户名，唯一", example = "john_doe")
    private String username;

    @NotBlank(message = "密码不能为空")
    @Size(min = 6, max = 100, message = "密码长度必须在 6 到 100 个字符之间")
    @Schema(description = "用户密码", example = "P@sswOrd123")
    private String password;

    @NotBlank(message = "确认密码不能为空")
    @Schema(description = "确认密码，必须与密码字段一致", example = "P@sswOrd123")
    private String confirmPassword;


    @Email(message = "邮箱格式不正确")
    @Size(max = 100, message = "邮箱长度不能超过 100 个字符")
    @Schema(description = "用户邮箱，可选填", example = "user@example.com")
    private String email;

    @Size(max = 50, message = "昵称长度不能超过 50 个字符")
    @Schema(description = "用户昵称，可选填", example = "Johnny")
    private String nickname;

}
